﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace tetris_data
{
    public class Block
    {
        public Block(int width, int height, CellColor color, bool[,] data)
        {
            Width = width;
            Height = height;
            Color = color;
            Data = data;
        }
        public int Width { get; private set; }
        public int Height { get; private set; }
        public bool[,] Data { get; private set; }
        public CellColor Color { get; private set; }

        private static Block[] blocks;

        public static Block[] Blocks
        {
            get
            {
                if (blocks == null)
                {
                    blocks = new Block[7];
                    bool[,] b0 = { { true, true, false, false }, { true, true, false, false },
                    { false, false, false, false }, { false, false, false, false } };
                    var color = new CellColor() { R = 0xFF, G = 0, B = 0 };
                    blocks[0] = new Block(2, 2, color, b0);

                    bool[,] b1 = { { true, false, false, false }, { true, false, false, false },
                    { true, false, false, false }, { true, false, false, false } };
                    color = new CellColor() { R = 0, G = 0xFF, B = 0 };
                    blocks[1] = new Block(1, 4, color, b1);

                    bool[,] b2 = { { false, true, true, false }, { true, true, false, false },
                    { false, false, false, false }, { false, false, false, false } };
                    color = new CellColor() { R = 0, G = 0, B = 0xFF };
                    blocks[2] = new Block(3, 2, color, b2);

                    bool[,] b3 = { { true, true, false, false }, { false, true, true, false },
                    { false, false, false, false }, { false, false, false, false } };
                    color = new CellColor() { R = 0xFF, G = 0xFF, B = 0 };
                    blocks[3] = new Block(3, 2, color, b3);

                    bool[,] b4 = { { true, true, true, false }, { false, false, true, false },
                    { false, false, false, false }, { false, false, false, false } };
                    color = new CellColor() { R = 0xFF, G = 0, B = 0xFF };
                    blocks[4] = new Block(3, 2, color, b4);

                    bool[,] b5 = { { true, true, true, false }, { true, false, false, false },
                    { false, false, false, false }, { false, false, false, false } };
                    color = new CellColor() { R = 0, G = 0xFF, B = 0xFF };
                    blocks[5] = new Block(3, 2, color, b5);

                    bool[,] b6 = { { false, true, false, false }, { true, true, true, false },
                    { false, false, false, false }, { false, false, false, false } };
                    color = new CellColor() { R = 0xF4, G = 0xA4, B = 0x60 };
                    blocks[6] = new Block(3, 2, color, b6);

                }
                return blocks;
            }
        }
    }
}
